package interfaces.spawnMenu;

import org.fenggui.StatefullWidget;
import org.fenggui.appearance.LabelAppearance;
import org.fenggui.binding.render.ImageFont;
import org.fenggui.decorator.background.PlainBackground;
import org.fenggui.util.Color;

import fileHandling.language.Lang;

import interfaces.language.LanguageButton;

public class ReadyButton extends LanguageButton {
	
	private PlainBackground readyBG, notReadyBG, hoveredBG;
	
	public ReadyButton(Lang text, ImageFont font) {
		super(text, font);
		
		readyBG = new PlainBackground(Color.GREEN);
		notReadyBG = new PlainBackground(Color.RED);
		hoveredBG = new PlainBackground(Color.BLUE);
		
		setReady(false);
	}
	
	public void setReady(boolean ready) {
		LabelAppearance app = getAppearance();
		
		app.removeAll();
		app.add(StatefullWidget.STATE_DEFAULT, ready ? readyBG : notReadyBG);
		app.add(StatefullWidget.STATE_HOVERED, hoveredBG);
		
		app.setEnabled(StatefullWidget.STATE_DEFAULT, true);
		app.setEnabled(StatefullWidget.STATE_HOVERED, false);
		
		layout();
	}
}